package com.fudan.framework.entity;

import java.util.Collection;

/**
 * table的ajax消息封装
 * @author Xuxinxing
 *
 */
public class TableJson {

	private Integer code;
	private String msg;
	private Long count;
	private Collection<Object> data;

	private TableJson() {}
	public static TableJson build(Collection<? super Object> list,Integer code,String msg,long count) {
		TableJson json = new TableJson();
		json.setCode(code);
		json.setMsg(msg);
		json.setData(list);
		json.setCount(count);
		return json;
	}
	public static TableJson build(Collection<? extends Object> list,long count) {
		Collection<? super Object> l = (Collection<? super Object>) list;
		return build(l,0,"",count);
	}
	public static TableJson build(int code,String msg) {
		return build(null,code,msg,0);
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Long getCount() {
		return count;
	}

	public void setCount(Long count) {
		this.count = count;
	}

	public Collection<? super Object> getData() {
		return data;
	}

	public void setData(Collection<? extends Object> data) {
		this.data = (Collection<? super Object>) data;
	}

}
